package com.paxcodi.rmi.chat;

import java.rmi.Remote;
import java.rmi.RemoteException;

public interface Chat extends Remote {
    //methods, i.e. method interfaces, are public abstract by definition
    /**
     * Registers the <code>userName</code> as chat participant at <code>Chat</code>.
     * 
     * @param userName name of user to be registered as chat participant 
     */
    void register(String userName) throws RemoteException;

    /**
     * 
     * @param nextLine
     * @param userName
     */
    void sendMsgFromUser(String nextLine, String userName) throws RemoteException;

    /**
     * 
     * @param userName
     * @return null if no messages wait to be polled
     */
    public String getMsgForUser(String userName) throws RemoteException;

    /**
     * 
     * @param userName user to leave chat
     */
    void unregister(String userName) throws RemoteException;
}
